﻿using System;
using System.Windows.Media.Imaging;
using Caliburn.Micro;

namespace Wulong.Phone.Qiushi.ViewModels
{
    public class PicViewModel : Screen
    {
        private INavigationService _navigationService;
        public PicViewModel(INavigationService navigationService)
        {
            _navigationService = navigationService;
        }

        private string _imageUrl;
        public string ImageUrl { get { return _imageUrl; } 
            set
                {
                    _imageUrl = value;
                    _imageSource = new BitmapImage(new Uri(_imageUrl));
                    NotifyOfPropertyChange(() => ImageSource);
                } 
        }

        private BitmapImage _imageSource;
        public BitmapImage ImageSource
        {
            get { return _imageSource; }
            set { _imageSource = value; NotifyOfPropertyChange(() => ImageSource); }
        }

        public void GoBack()
        {
            _navigationService.GoBack();
        }
    }
}
